<template>
	<view class="content">
		<image class="logo" src="https://www.diyifanwen.com/files/sucai/shoujitupian/2008-7/13/0871302083517006.jpg"></image>
		<image class="logo" src="/static/logo.png"></image>
		<image class="logo" src="/static/logo.png"></image>
		<image class="logo" src="/static/logo.png"></image>
		<view class="text-area">
			<text class="title">{{title}}</text>
		</view>

		<div>
			<p>点击次数: {{count}}</p>
			<child-1 :btnName1="btnName" @update_count="changeCount" />
		</div>

	</view>



</template>



<script>
	import Child1 from './Child1'


	export default {
		components: {
			'child-1': Child1
		},
		data() {
			return {
				title: 'Hello',
				btnName: ' 我是一个button',
				count: 0
			}
		},
		onLoad() {

		},
		methods: {

			// TreeNode1(val) {
			// 	return{
			// 		val: val,
			// 		left: null,
			// 		right: null
			// 	}
			// },
			changeCount(val) {
				this.count = this.count + val;

				var treenode = TreeNode(1);
				var treenode2 = TreeNode(2);   treenode.left =treenode2; 
				var treenode3 = TreeNode(3);treenode.right =treenode3;
								var treenode5 = TreeNode(5);treenode2.right =treenode5;


				console.log( binaryTreePaths(treenode))
				// var object =this.$options.methods.TreeNode1(val)
				// console.log( object ) 

			},




		},


	}



	function TreeNode(vale) {
		return{
			val: vale,
			left: null,
			right: null
		}
	}
	const paths = [];
	var binaryTreePaths = function(root) {
		
		var currentstr = root.vale;
		searchnode(root, currentstr, paths);
		return paths;
	};


	var searchnode = function(node, str, paths) {
		if (node) {
			if (node.left == null && node.right == null) {
				str += "->" + node.val;
				console.log( paths);
				paths.push(str);
			} else {
				searchnode(node.left);
				searchnode(node.right)
			}
		}
	};
</script>

<!--<style>-->
	<!--.content {-->
		<!--display: flex;-->
		<!--flex-direction: column;-->
		<!--align-items: center;-->
		<!--justify-content: center;-->
	<!--}-->

	<!--.logo {-->
		<!--height: 200rpx;-->
		<!--width: 200rpx;-->
		<!--margin-top: 200rpx;-->
		<!--margin-left: auto;-->
		<!--margin-right: auto;-->
		<!--margin-bottom: 50rpx;-->
	<!--}-->

	<!--.text-area {-->
		<!--display: flex;-->
		<!--justify-content: center;-->
	<!--}-->

	<!--.title {-->
		<!--font-size: 36rpx;-->
		<!--color: #8f8f94;-->
	<!--}-->
<!--</style>-->
